// TCP客户端
import net from 'net';

let port = 9999;
let host = '114.117.172.4';

const client = net.createConnection(port, host, () => {
    console.log('连接到服务器！');
    client.write('你好，服务器！');
    // client.end();
});

client.on('data', (data) => {
    console.log('服务器返回的数据：', data.toString());
});

client.on('end', () => {
    console.log('断开与服务器的连接');
});